import { createRouter, createWebHistory, createWebHashHistory } from "vue-router";
import type { RouteRecordRaw } from "vue-router";
const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        redirect: "/index",
    },
    {
        path: "/home",
        name: "home",
        component: () => import("@/views/HomeView.vue"),
        children: [
            {
                path: "/index",
                name: "index",
                component: () => import("@/views/index/index.vue"),
            },
            {
                path: "/order",
                name: "order",
                component: () => import("@/views/order/index.vue"),
            },
            {
                path: "/product",
                name: "product",
                component: () => import("@/views/product/index.vue"),
            },
            {
                path: "/users",
                name: "users",
                component: () => import("@/views/users/index.vue"),
            }
        ],
    },
];
const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes,
});

router.beforeEach((to, from, next) => {
    next();
});

export default router;
